package com.jsmile.cloud.authc.sys.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.jsmile.cloud.authc.api.req.sys.ReqSysDictUpdate;

import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * @author 龚亮
 * @version 1.0
 * @desc 为了薪资破万，还是睡一会儿吧...!
 * @date 2019年11月01日 08:52:39
 */
@ApiModel
@Data
@TableName("t_op_sys_dictionary")
public class SysDictionary extends Model<SysDictionary> {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "id")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    @ApiModelProperty(value = "字典值名称")
    private String dictName;
    @ApiModelProperty(value = "字典编码")
    private String dictValue;
    @ApiModelProperty(value = "字典编码")
    private String dictCode;
    @ApiModelProperty(value = "parent_id")
    private Long parentId;
    @ApiModelProperty(value = "层级")
    private Integer level;
    @ApiModelProperty(value = "排序")
    private Integer sort;
    @ApiModelProperty(value = "是否可见 1是 0否")
    private Integer visible;
    @ApiModelProperty(value = "是否可新增（1是 0否）")
    private Integer addable;
    @ApiModelProperty(value = "是否可用 1是  0否")
    private Integer enable;
    @ApiModelProperty(value = "是否系统预置 （1是 0否，系统预置不可以修改）")
    private Integer init;
    @ApiModelProperty(value = "创建者")
    private String createBy;
    @ApiModelProperty(value = "更新者")
    private String updateBy;
    @ApiModelProperty(value = "创建时间")
    private java.util.Date createTime;
    @ApiModelProperty(value = "更新时间")
    private java.util.Date updateTime;
    @ApiModelProperty(value = "描述")
    private String remark;
    @ApiModelProperty(value = "系统编码")
    private String sysNo;
    @ApiModelProperty(value = "租户id")
    private Long tenantId;
    @TableLogic
    @ApiModelProperty(value = "是否删除 1是 0否")
    private Integer delFlag;

    public static SysDictionary create(ReqSysDictUpdate reqSysDictUpdate) {
        SysDictionary sysDictionary = BeanUtil.toBean(reqSysDictUpdate, SysDictionary.class);
        return sysDictionary;
    }
}
